package com.fr.data;

import com.fr.base.core.ComparatorUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import com.fr.report.io.xml.ReportXMLUtils;
import com.fr.report.parameter.Parameter;
import java.util.ArrayList;
import java.util.List;

public abstract class AbstractTableData
  implements TableData
{
  protected Parameter[] parameters;

  public boolean hasRow(int paramInt)
    throws TableDataException
  {
    return ((paramInt >= 0) && (paramInt < getRowCount()));
  }

  public Parameter[] getParameters()
  {
    return ((this.parameters == null) ? new Parameter[0] : this.parameters);
  }

  public void release()
    throws Exception
  {
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str = paramXMLableReader.getTagName();
      if ("Parameters".equals(str))
      {
        ArrayList localArrayList = new ArrayList();
        paramXMLableReader.readXMLObject(new XMLReadable(this, localArrayList)
        {
          private final List val$tmpParameterList;
          private final AbstractTableData this$0;

          public void readXML()
          {
            if ("Parameter".equals(paramXMLableReader.getTagName()))
              this.val$tmpParameterList.add(ReportXMLUtils.readParameter(paramXMLableReader));
          }
        });
        if (localArrayList.size() > 0)
        {
          this.parameters = new Parameter[localArrayList.size()];
          localArrayList.toArray(this.parameters);
        }
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    ReportXMLUtils.writeParameters(paramXMLPrintWriter, this.parameters);
  }

  public boolean equals(Object paramObject)
  {
    return ((paramObject instanceof AbstractTableData) && (ComparatorUtils.equals(this.parameters, ((AbstractTableData)paramObject).parameters)));
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    int i;
    AbstractTableData localAbstractTableData = (AbstractTableData)super.clone();
    if (this.parameters != null)
    {
      localAbstractTableData.parameters = new Parameter[this.parameters.length];
      for (i = 0; i < this.parameters.length; ++i)
        localAbstractTableData.parameters[i] = ((Parameter)this.parameters[i].clone());
    }
    return localAbstractTableData;
  }
}